import AccountBackButton from '@theme/views/account/back-button'; import AccountMenu from '@theme/views/account/account-menu'; import ChromeSlot from '@akinon/pz-theme/src/chrome/chrome-slot'; import { PLACEHOLDER_SLUGS } from '@akinon/pz-theme/src/chrome/placeholder-slugs'; import { buildAccountPageContext } from '@akinon/pz-theme/src/chrome/page-context'; import { auth } from 'auth'; import { ROUTES } from 'routes'; import { redirect } from '@akinon/next/utils/redirect'; export default async function AccountLayout({ children }: { children: React.ReactNode; }) { const session = await auth(); if (!session?.user) { return redirect(ROUTES.AUTH); } return ( // Stacked on mobile, two columns on desktop. The brand markup hides // itself on the breakpoints it does not serve, but a COMPOSED menu or // page body has no such classes — in a no-wrap row it would render // crushed next to its sibling on a phone; in a column it stacks.
{/* The menu keeps its own responsive column classes (incl. hiding itself on mobile subpages), so the slot chain must stay layout-transparent — hence `contents` on both wrappers. A menu takeover renders on every account screen and replaces the logout button too; the designer rebuilds it from the block vocabulary. */} } className="contents" fallbackClassName="contents" pageContext={buildAccountPageContext({ path: ROUTES.ACCOUNT, sessionUser: session.user as Record })} />
{/* The session is already awaited above, so the account context costs no extra fetch. Profile-only fields (phone, gender) stay empty until a live provider merges them in. */} {/* Layout-level band on EVERY account screen. Never give this slot a `fallback`: taking the shell over would replace `children` — and with it every per-subpage slot mounted below. */} })} /> {children}
); }